<?php

class Application_Model_DbTable_WeiboUser extends Zend_Db_Table_Abstract
{

    protected $_name = 'txy_weibo_user';
    
    public function addNew($data){
        try{
            $this->insert($data);
        }catch (Exception $e){
            $this->updateUser($data);
        }
    }
    public function updateUser($data){
      $this->update($data, "uidstr='".$data['uidstr']."'");
    }
    
    public function getUserById($userId){
        $res=$this->fetchRow("uidstr =".$userId);
        return $res->toArray();
    }
    
    public function getTopUsers($limit=20){
        $res=$this->fetchAll('showfalg = 1','statuses asc',$limit);
        return $res->toArray();
    }

}

